UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'o81Dbda+GWfE1B69pvOtgNWlDVTqGXM7BgNdlope40g=' 
WHERE 
  key_id = 'ff1585e41ebefd127f303623ca3611d4e864170ea1bb893d97ad549333ff2a41' 
  AND (
    token = 'o81Dbda+GWfE1B69pvOtgNWlDVTqGXM7BgNdlope40g=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030