UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2kCSXMqgH4hVmQ6DNnBVhCJ91xlSz9Cwr6YFg4usKxw=' 
WHERE 
  key_id = 'bc4370f30bf53e819f147539072a9bf2cf32062451eaf3a344a1d3bc04b3b706' 
  AND (
    token = '2kCSXMqgH4hVmQ6DNnBVhCJ91xlSz9Cwr6YFg4usKxw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025