UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'TWAq+m0tpIpYjxDmJPzu8GC79fACb91ai3YtRlR6uVs=' 
WHERE 
  key_id = '7477891b0c8ba00169353652bb9808f34065a0415f2a8dcc59e10e80b5d98f49' 
  AND (
    token = 'TWAq+m0tpIpYjxDmJPzu8GC79fACb91ai3YtRlR6uVs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037