UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aJB89+3pw/wU3hE5MoFjFguWsjmw1iOrrMk7wEWxxRY=' 
WHERE 
  key_id = '4299d6cfc2636d9bc8a1b4b7a551f3221042968f2a36d0dea6e2be076635c6fc' 
  AND (
    token = 'aJB89+3pw/wU3hE5MoFjFguWsjmw1iOrrMk7wEWxxRY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00016