UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cCB2y2dp8FE6JwytisY+uX98MvxshzrnJ420c4kYUws=' 
WHERE 
  key_id = '5df0bc705ce73709a64b5f855f1cf9226fbf5537985ff1e81f3308fda781d089' 
  AND (
    token = 'cCB2y2dp8FE6JwytisY+uX98MvxshzrnJ420c4kYUws=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037