UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'd/+omLog96RyTfq4du3lpKnS2YyR8ewrNRteatyu9tQ=' 
WHERE 
  key_id = '846466b747054cdb6192075130fe79b16880451e001427e588c8fc79b5ae1bca' 
  AND (
    token = 'd/+omLog96RyTfq4du3lpKnS2YyR8ewrNRteatyu9tQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050