UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LbuJ5GS+dY0QsIrsEGKb7DCYA0Q26QFVE8lcLuwv97Q=' 
WHERE 
  key_id = 'ad787e8ec1f906b1de5f234eb68b932573651ed93db49c8466202d5788a9d1bb' 
  AND (
    token = 'LbuJ5GS+dY0QsIrsEGKb7DCYA0Q26QFVE8lcLuwv97Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043