UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KpwdS4+K7gyUN9ZzMtXbtpr0PDUwfPR/RRXj3GEZzQk=' 
WHERE 
  key_id = '8e95eab567b6e7fe193f2b6d74bd0cca6184cde23700b1061e79ed47fc477eab' 
  AND (
    token = 'KpwdS4+K7gyUN9ZzMtXbtpr0PDUwfPR/RRXj3GEZzQk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034