UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'tvlwNeTYlAmzFIX0rlE8GNxL2s7VfAbsP+auLreufkw=' 
WHERE 
  key_id = '34100bf79eb8f5ecd3ba9fba51e26469ae05a64baf71d429dbbba2d8e8a83917' 
  AND (
    token = 'tvlwNeTYlAmzFIX0rlE8GNxL2s7VfAbsP+auLreufkw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040