UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iNPQuf7jwigMcTNIXu2sXF5gXf56MTfWo0KgGmYdTMs=' 
WHERE 
  key_id = '531d390280f94264cbb823300c4956273585b8872790557420b3bec05edc5f62' 
  AND (
    token = 'iNPQuf7jwigMcTNIXu2sXF5gXf56MTfWo0KgGmYdTMs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047