UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eHvlXdak9AEm1EqAIb0wlsTlHZelOFLgbAnQ0X+UfCM=' 
WHERE 
  key_id = '5b58e3c10b90359576a4e1ee6e17d9bac20cd4af09cb74627d2df929cd44f20c' 
  AND (
    token = 'eHvlXdak9AEm1EqAIb0wlsTlHZelOFLgbAnQ0X+UfCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027