UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'D5Ff6KWa3pw3LdgSpsgNZ5VfQG0WP7HGCFZJaeltyv4=' 
WHERE 
  key_id = '2dd816c45d0e2dba6d10467873de8a769b25a998ff3cb80038756c27b77100e6' 
  AND (
    token = 'D5Ff6KWa3pw3LdgSpsgNZ5VfQG0WP7HGCFZJaeltyv4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028