UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aAb88r/E72n/+9nCCkzptVpWurhIgjrxJbZnYD8vPd0=' 
WHERE 
  key_id = '513ea4c0d368868d71394494c1cfd5a29726c8456358f2b3ebbf362cc846c629' 
  AND (
    token = 'aAb88r/E72n/+9nCCkzptVpWurhIgjrxJbZnYD8vPd0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046