UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '8bqFiyfpKKIMLE7VS6rBSZFWjK0yKywxsCv675VDGKE=' 
WHERE 
  key_id = 'a61500d199575638bf09b344a446d0465d4cac83a72606af3bb7b4effbaada72' 
  AND (
    token = '8bqFiyfpKKIMLE7VS6rBSZFWjK0yKywxsCv675VDGKE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00038