UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'N5GiKc3iAeAmV98kuYZFS4kHlEl42RZwjh7rCeM52ww=' 
WHERE 
  key_id = '864686c7a8cd24698ac8ea30cb2e69ca146ae83d5efb2f4aa01aecaea60990c3' 
  AND (
    token = 'N5GiKc3iAeAmV98kuYZFS4kHlEl42RZwjh7rCeM52ww=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026