UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '3ZvH7SxkUrMVtXDnJwgrG1Whq63G8ZhwQJMoTzm0AOw=' 
WHERE 
  key_id = 'affc314b18fb10c5d9c598e253f45b0fb09aaee6fb60efb3b4fe00af7d41cb35' 
  AND (
    token = '3ZvH7SxkUrMVtXDnJwgrG1Whq63G8ZhwQJMoTzm0AOw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048