UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'A8tS1jLBDxbU742LA5BS+YG48MAJ2z4tH6S56ofkjlc=' 
WHERE 
  key_id = '1e065b7f88b3eea6ed161c5ab4f21fb47a2852f7375a1772b1ffe7a3f93d884b' 
  AND (
    token = 'A8tS1jLBDxbU742LA5BS+YG48MAJ2z4tH6S56ofkjlc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032