UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mE+CMRWkGAla4Ij8r2sxv0hAZhg8hHlyJ+3UUHefAL8=' 
WHERE 
  key_id = 'ad1c072732ba557574163ad46d7606f7ff384736d5ce5d097b6917c16f106bc2' 
  AND (
    token = 'mE+CMRWkGAla4Ij8r2sxv0hAZhg8hHlyJ+3UUHefAL8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026