UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'yAsB7Mb296LIp8f5BAQ7a2cNtXbb7DKATtvv0nq9zSA=' 
WHERE 
  key_id = 'fdf322578ff48bf762c667604905b1f0d65f726446aaecb0e3431226cce92bef' 
  AND (
    token = 'yAsB7Mb296LIp8f5BAQ7a2cNtXbb7DKATtvv0nq9zSA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035