UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DQOX1C/IIHzpDgTEeLUFThDdahGbX+meL/mO79cdhvU=' 
WHERE 
  key_id = '8d0246f0161430d54d032de7240dca46add0b4187cc5a8ea96486db2fa228c43' 
  AND (
    token = 'DQOX1C/IIHzpDgTEeLUFThDdahGbX+meL/mO79cdhvU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00031