UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HY8qN6l0cn+UL6MpCjqXvcsw7+bfefxn2apexbPXAjg=' 
WHERE 
  key_id = '4f81f2681c18d03853167e8ff27dce6eff52e02fd713273a85f4f7601d02a78d' 
  AND (
    token = 'HY8qN6l0cn+UL6MpCjqXvcsw7+bfefxn2apexbPXAjg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052