UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XW/aSDCZniinSpRP/szinDjRhQWUiTIhhQZke5osbns=' 
WHERE 
  key_id = 'd75673c734e3f740f73f3181680a2ded8e1b2e6e39f0701c3799546fc1451230' 
  AND (
    token = 'XW/aSDCZniinSpRP/szinDjRhQWUiTIhhQZke5osbns=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034