UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'QtM61fU6x7dwtn3/40qzZE19lXdoMpQLRw6a5uNqHO8=' 
WHERE 
  key_id = '5bca30ef73e55c8e4b8816d643bf54ac7a968005f44010b2b0cb11ee3a016762' 
  AND (
    token = 'QtM61fU6x7dwtn3/40qzZE19lXdoMpQLRw6a5uNqHO8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026