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

Query time 0.00041