UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LbCMJQjP5FO1fS54yRQTkMbTkrXKiAl34esnm1RDgjA=' 
WHERE 
  key_id = '9fe608e9cfe00289c30d2ae29a7c7b94eb77e58943053683630af20dd710ce55' 
  AND (
    token = 'LbCMJQjP5FO1fS54yRQTkMbTkrXKiAl34esnm1RDgjA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00067