UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5haJKMhwvPIogt6PPBNc7+1msEDPNn/tR7EEkuNjZs=' 
WHERE 
  key_id = '4af3057f87ef015ac47a90255a5bcd9a81d071af89b66713d5af1f4085830982' 
  AND (
    token = 'N5haJKMhwvPIogt6PPBNc7+1msEDPNn/tR7EEkuNjZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00018