UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DEPCB0gGH7PKy2L0xqQjlyQNCEVt7gj4RN1XTdG/ihc=' 
WHERE 
  key_id = '9f27a93f776e68eb04d14385053d58b7f95c2fc0395e185943a9824e200e3e17' 
  AND (
    token = 'DEPCB0gGH7PKy2L0xqQjlyQNCEVt7gj4RN1XTdG/ihc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037