UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aYps1LJKUR0KFUsNUQW/knicIKvAUbl40K/CXaebsEw=' 
WHERE 
  key_id = '8a6316f11829172e6a3619043117b133473f574fcbff064dab1ad20a494e2a9d' 
  AND (
    token = 'aYps1LJKUR0KFUsNUQW/knicIKvAUbl40K/CXaebsEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025